package com.schoolcloud.files.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import lombok.Data;

/**
 * 文件访问日志表
 * @TableName file_access_log
 */
@TableName(value ="file_access_log")
@Data
public class FileAccessLog implements Serializable {
    /**
     * 主键ID
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 关联文件主表ID
     */
    @TableField(value = "file_id")
    private Long fileId;

    /**
     * 访问IP
     */
    @TableField(value = "access_ip")
    private String accessIp;

    /**
     * 访问用户ID
     */
    @TableField(value = "user_id")
    private String userId;

    /**
     * 访问时间
     */
    @TableField(value = "access_time")
    private LocalDateTime accessTime;

    /**
     * 用户代理
     */
    @TableField(value = "user_agent")
    private String userAgent;

    /**
     * 状态：0-失败 1-成功
     */
    @TableField(value = "status")
    private Integer status;

    /**
     * 响应耗时（毫秒）
     */
    @TableField(value = "duration")
    private Integer duration;

    @Serial
    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
}
